package com.ruoyi.yipaiju.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.yipaiju.domain.DiscountHouseBookingorder;
import com.ruoyi.yipaiju.service.IDiscountHouseBookingorderService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * fo_discount_house_bookingorderController
 * 
 * @author liuwp
 * @date 2023-03-01
 */
@RestController
@RequestMapping("/yipaiju/discount_house_bookingorder")
public class DiscountHouseBookingorderController extends BaseController
{
    @Autowired
    private IDiscountHouseBookingorderService discountHouseBookingorderService;

    /**
     * 查询fo_discount_house_bookingorder列表
     */
    @PreAuthorize("@ss.hasPermi('yipaiju:discount_house_bookingorder:list')")
    @GetMapping("/list")
    public TableDataInfo list(DiscountHouseBookingorder discountHouseBookingorder)
    {
        startPage();
        List<DiscountHouseBookingorder> list = discountHouseBookingorderService.selectDiscountHouseBookingorderList(discountHouseBookingorder);
        return getDataTable(list);
    }

    /**
     * 导出fo_discount_house_bookingorder列表
     */
    @PreAuthorize("@ss.hasPermi('yipaiju:discount_house_bookingorder:export')")
    @Log(title = "fo_discount_house_bookingorder", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DiscountHouseBookingorder discountHouseBookingorder)
    {
        List<DiscountHouseBookingorder> list = discountHouseBookingorderService.selectDiscountHouseBookingorderList(discountHouseBookingorder);
        ExcelUtil<DiscountHouseBookingorder> util = new ExcelUtil<DiscountHouseBookingorder>(DiscountHouseBookingorder.class);
        util.exportExcel(response, list, "fo_discount_house_bookingorder数据");
    }

    /**
     * 获取fo_discount_house_bookingorder详细信息
     */
    @PreAuthorize("@ss.hasPermi('yipaiju:discount_house_bookingorder:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(discountHouseBookingorderService.selectDiscountHouseBookingorderById(id));
    }

    /**
     * 新增fo_discount_house_bookingorder
     */
    @PreAuthorize("@ss.hasPermi('yipaiju:discount_house_bookingorder:add')")
    @Log(title = "fo_discount_house_bookingorder", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DiscountHouseBookingorder discountHouseBookingorder)
    {
        return toAjax(discountHouseBookingorderService.insertDiscountHouseBookingorder(discountHouseBookingorder));
    }

    /**
     * 修改fo_discount_house_bookingorder
     */
    @PreAuthorize("@ss.hasPermi('yipaiju:discount_house_bookingorder:edit')")
    @Log(title = "fo_discount_house_bookingorder", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DiscountHouseBookingorder discountHouseBookingorder)
    {
        return toAjax(discountHouseBookingorderService.updateDiscountHouseBookingorder(discountHouseBookingorder));
    }

    /**
     * 删除fo_discount_house_bookingorder
     */
    @PreAuthorize("@ss.hasPermi('yipaiju:discount_house_bookingorder:remove')")
    @Log(title = "fo_discount_house_bookingorder", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(discountHouseBookingorderService.deleteDiscountHouseBookingorderByIds(ids));
    }
}
